require('module-alias/register')
const express = require('express')
const app = express()
// const cors = require("cors")
const routeIndex = require("./src/routes/index")
// app.use(cors())
app.all("*", (req, res, next) => {
  res.header("Cache-Control", "no-cache, no-store, must-revalidate")
  res.header("Pragma", "no-cache")
  res.header("Expires", 0)
  // res.header("Access-Control-Allow-Origin", "*")
  // res.header("Access-Control-Allow-Headers", "X-Requested-With")
  // res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS")
  // res.header("X-Powered-By", '3.2.1')
  // res.header("Content-Type", "application/json;charset=utf-8")
  next()
});

app.use(routeIndex)
const server = app.listen( 8150 , function () {
  var host = "localhost";
  var port = server.address().port;
  console.log("地址为 http://%s:%s", host, port);
})